package com.yiqi.zhiyuan.feature.certification.view.adapter;

import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yiqi.zhiyuan.R;
import com.yiqi.zhiyuan.entity.vo.CarColorVO;

/**
 * @ProjectName: ZhiYuan
 * @Description: java类作用描述
 * @Author: lijuwen
 * @CreateDate: 2019/4/17 16:44
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/4/17 16:44
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class ColorAdapter extends BaseQuickAdapter<CarColorVO, BaseViewHolder> {
    public ColorAdapter() {
        super(R.layout.item_select_color);
    }

    @Override
    protected void convert(BaseViewHolder helper, CarColorVO item) {
        helper.setText(R.id.tv_color_name,item.getColourName());
        RelativeLayout relativeLayout=helper.getView(R.id.rl_color);
        GradientDrawable p = (GradientDrawable) relativeLayout.getBackground();
        p.setColor(Color.parseColor(item.getRgb()));
    }
}
